;
;        FILE: ADVCODE2.ASM   --   SEA SEARCH
;

;        LOOK DRESSER

LOOK01   PROC
         CMP   ROOM,1
         LBNE  NOSEE
         MOV   AL,11+INV          ;FLASHLIGHT
         CALL  MAKVIS
         JE    LOOK01_B
LOOK01_A:
         CALL  CKDRAW
         JMP   DMSG011
LOOK01_B:
         MOV   AL,10+INV          ;WALLET
         CALL  MAKVIS
         JNE   LOOK01_A
         JMP   DMSG012
LOOK01   ENDP

;        LOOK BED

LOOK02   PROC
         CMP   ROOM,1
         LBNE  NOSEE
         JMP   DMSG013
LOOK02   ENDP

;        LOOK VALET

LOOK03   PROC
         CMP   ROOM,1
         LBNE  NOSEE
         MOV   AL,9+INV           ;JEANS & SHIRT
         CALL  MAKVIS
         LBEQ  DMSG012
         CALL  CKDRAW
         JMP   DMSG011
LOOK03   ENDP

;        LOOK UNDER

LOOK04   PROC
         MOV   BX,OFFSET MSG014
         CALL  DISPLY
         CALL  GETLIN
         CALL  SCNKEY
         CMP   VERBNO,21          ;UNDER?
         JE    LOOK04_B
         CMP   VERBNO,12          ;BED?
         JNE   LOOK04_C
LOOK04_A:
         CMP   ROOM,1
         LBNE  NOSEE
         MOV   AL,8+INV           ;SHOES
         CALL  MAKVIS
         LBEQ  DMSG012
         CALL  CKDRAW
         JMP   DMSG011
LOOK04_B:
         CMP   NOUNNO,127         ;UNDER BED?
         JE    LOOK01_A
LOOK04_C:
         JMP   BADINP
LOOK04   ENDP

;        LOOK BILLBOARD

LOOK05   PROC
         CMP   ROOM,2
         LBNE  NOSEE
         MOV   BX,OFFSET MSG056
         CALL  DISPLY
         JMP   REPLY
LOOK05   ENDP

;        LOOK LANDLORD

LOOK06   PROC
         MOV   AL,121
         CALL  CKOBJ
         LBEQ  DMSG023
         JMP   DMSG027
LOOK06   ENDP

;        LOOK WALLET

LOOK07   PROC
         CALL  EQUOBJ
         MOV   AL,NOUNNO
         CALL  LOCOBJ
         LBNE  DMSG012
         JMP   NOSEE
LOOK07   ENDP

;        LOOK DOOR

LOOK08   PROC
         CMP   ROOM,3
         LBEQ  DMSG029
         CALL  EQUOBJ
         MOV   AL,NOUNNO
         CALL  CKOBJ
         LBNE  LOOKOB
         CMP   ROOM,43
         LBEQ  DMSG019
         JMP   NOSEE
LOOK08   ENDP

;        LOOK PACKAGE

LOOK09   PROC
         MOV   AL,22              ;PACKAGE
         CALL  HAVOBJ
         LBEQ  NOHAVE
         JMP   DMSG035
LOOK09   ENDP

;        LOOK GARBAGE

LOOK10   PROC
         CMP   ROOM,9
         LBNE  NOSEE
         MOV   AL,17+INV          ;GOLD TOKEN
         CALL  MAKVIS
         LBEQ  DMSG012
         CALL  CKDRAW
         JMP   DMSG011
LOOK10   ENDP

;        LOOK SIGN

LOOK11   PROC
         MOV   AL,ROOM
         CMP   AL,2
         LBEQ  LOOK05
         CMP   AL,11
         LBEQ  DMSG020
         CMP   AL,22
         LBEQ  DMSG059
         CMP   AL,12
         LBNE  NOSEE
         JMP   DMSG037
LOOK11   ENDP

;        GO DOOR

GO01     PROC
         MOV   AL,ROOM
         CMP   AL,1
         JE    GO01_A
         CMP   AL,3
         JE    GO01_A
         CMP   AL,22
         JE    GO01_B
         CMP   AL,43
         JE    GO01_C
         JMP   NOSEE
GO01_A:
         MOV   AL,111             ;CLOSED DOOR
         CALL  CKOBJ
         LBNE  DMSG019
         MOV   AL,ROOM
         XOR   AL,00000010B
         JMP   SHORT GO01_D
GO01_B:
         MOV   AL,98              ;OPEN TRAP DOOR
         CALL  CKOBJ
         LBEQ  NOSEE
         MOV   AL,43
         JMP   SHORT GO01_D
GO01_C:
         MOV   AL,98              ;OPEN TRAP DOOR
         CALL  CKOBJ
         LBEQ  DMSG019
         MOV   AL,22
GO01_D:
         JMP   EXITRM
GO01     ENDP

;        GO WINDOW

GO02     PROC
         MOV   AH,ROOM
         CMP   AH,1
         JE    GO02_A
         CMP   AH,2
         JE    GO02_A
         CMP   AH,3
         JE    GO02_A
         CMP   AH,22
         LBNE  NOSEE
GO02_A:
         MOV   AL,123             ;OPEN WINDOW
         CALL  CKOBJ
         LBEQ  DMSG019
         MOV   AL,AH
         DEC   AL
         JNE   GO02_B
         MOV   AL,2
GO02_B:
         JMP   EXITRM
GO02     ENDP

;        GO TURNSTILE

GO03     PROC
         CMP   ROOM,16
         LBNE  NOSEE
         MOV   AL,17              ;TOKEN
         CALL  HAVOBJ
         LBEQ  DMSG040
         MOV   BX,OFFSET MSG041
         CALL  DELAY
         MOV   AL,17
         JMP   EXITRM
GO03     ENDP

;        GO CABIN

GO04     PROC
         CMP   ROOM,21
         LBNE  NOSEE
         MOV   AL,22
         JMP   EXITRM
GO04     ENDP

;        GO CAVE

GO05     PROC
         MOV   AL,103             ;CAVE
         CALL  CKOBJ
         LBEQ  NOSEE
         MOV   AL,101             ;SNAKE
         CALL  CKOBJ
         LBNE  DMSG047
         MOV   AL,39
         JMP   EXITRM
GO05     ENDP

;        GO BRIDGE

GO06     PROC
         MOV   AL,97              ;BRIDGE
         CALL  CKOBJ
         LBEQ  NOSEE
         MOV   AL,ROOM
         XOR   AL,1
         JMP   EXITRM
GO06     ENDP

;        GO RAINBOW

GO07     PROC
         MOV   AL,100             ;RAINBOW
         CALL  CKOBJ
         LBEQ  NOSEE
         MOV   AL,46
         JMP   EXITRM
GO07     ENDP

;        PUT CLOTHES

PUT02    PROC
         MOV   AL,23              ;WEARING CLOTHES
         CALL  HAVOBJ
         LBEQ  NOHAVE
         JMP   DMSG030
PUT02    ENDP

;        PUT SHAMROCK

PUT04    PROC
         MOV   AL,NOUNNO
         CALL  HAVOBJ
         LBEQ  NOHAVE
         CMP   ROOM,38
         JNE   PUT04_A
         MOV   AL,101             ;SNAKE
         CALL  CKOBJ
         JE    PUT04_A
         SUB   AH,AH
         CALL  CHGOBJ
         CALL  CKDRAW
         MOV   AL,NOUNNO
         CALL  REPOBJ
         JMP   DMSG046
PUT04_A:
         JMP   VPUT
PUT04    ENDP

;        OPEN VERB PROCESSOR

VOPEN    PROC
         CMP   NOUNNO,124         ;WINDOW
         LBNE  BADINP
         MOV   AL,ROOM
         CMP   AL,3
         JE    VOPEN_C
         CMP   AL,22
         JE    VOPEN_C
         CMP   AL,1
         JE    VOPEN_B
         CMP   AL,2
         LBNE  NOSEE
VOPEN_B:
         MOV   AL,124
         CALL  CKOBJ
         LBEQ  DMSG015
         MOV   AH,123             ;OPEN WINDOW
         CALL  CHGOBJ
         DISABLE
         INC   ROOM
         CALL  CHGOBJ
         DEC   ROOM
         ENABLE
         JMP   DMSG016
VOPEN_C:
         JMP   DMSG018
VOPEN    ENDP

;        OPEN DOOR

OPEN01   PROC
         MOV   AL,ROOM
         CMP   AL,1
         JE    OPEN01_A
         CMP   AL,3
         JE    OPEN01_A
         CMP   AL,22
         JE    OPEN01_D
         CMP   AL,43
         JE    OPEN01_C
         JMP   NOSEE
OPEN01_A:
         MOV   AL,111             ;CLOSED DOOR
         CALL  CKOBJ
         LBEQ  DMSG015
         MOV   AH,112             ;OPEN DOOR
         CALL  CHGOBJ
OPEN01_B:
         JMP   REPLY
OPEN01_C:
         MOV   AL,98              ;OPEN TRAP DOOR
         CALL  CKOBJ
         LBNE  DMSG015
         MOV   AL,98
         CALL  PUTNRM
         CALL  CKDRAW
         DISABLE
         MOV   ROOM,22
         CALL  PUTNRM
         MOV   ROOM,43
         ENABLE
         JMP   SHORT OPEN01_B
OPEN01_D:
         MOV   AL,98              ;OPEN TRAP DOOR
         CALL  CKOBJ
         LBEQ  NOSEE
         JMP   DMSG015
OPEN01   ENDP

;        OPEN WALLET

OPEN02   PROC
         CALL  EQUOBJ
         MOV   AL,NOUNNO
         CALL  HAVOBJ
         LBEQ  NOHAVE
         CMP   AL,18              ;OPEN WALLET
         LBEQ  DMSG015
         MOV   AH,18
         CALL  REPOBJ
         MOV   AL,14              ;$102.00
         CALL  PUTNRM
         JMP   DMSG011
OPEN02   ENDP

;        OPEN MAILBOX

OPEN03   PROC
         CMP   ROOM,5
         LBNE  NOSEE
         MOV   BX,OFFSET MSG028
         CALL  DISPLY
         CALL  GETLIN
         CALL  SCNKEY
         MOV   AL,VERBNO
         CMP   AL,17              ;203?
         JE    OPEN03_A
         CMP   AL,16              ;BOX?
         LBNE  BADINP
         CMP   NOUNNO,21          ;203?
         LBNE  BADINP
OPEN03_A:
         MOV   AL,22+INV          ;PACKAGE
         CALL  MAKVIS
         LBEQ  REPLY
         CALL  CKDRAW
         JMP   DMSG011
OPEN03   ENDP

;        OPEN PACKAGE

OPEN04   PROC
         MOV   AL,22              ;PACKAGE
         CALL  HAVOBJ
         LBEQ  NOHAVE
         MOV   AH,24              ;POCKET KNIFE
         CALL  REPOBJ
         MOV   AL,13              ;WRAPPING PAPER
         CALL  PUTNRM
         JMP   DMSG011
OPEN04   ENDP

;        OPEN KNIFE

OPEN05   PROC
         MOV   AL,NOUNNO
         CALL  HAVOBJ
         LBEQ  NOHAVE
         MOV   AL,110             ;MUGGERS
         CALL  CKOBJ
         LBEQ  REPLY
         SUB   AH,AH
         CALL  CHGOBJ
         CALL  CKDRAW
         JMP   DMSG036
OPEN05   ENDP

;        CLOSE VERB PROCESSOR

VCLOSE   PROC
         CMP   NOUNNO,124         ;WINDOW
         LBNE  BADINP
         MOV   AL,ROOM
         CMP   AL,3
         LBEQ  DMSG021
         CMP   AL,1
         JE    VCLOSE_B
         CMP   AL,2
         LBNE  NOSEE
VCLOSE_B:
         MOV   AL,123             ;OPEN WINDOW
         CALL  CKOBJ
         LBEQ  DMSG021
         MOV   AH,124
         CALL  CHGOBJ
         DISABLE
         INC   ROOM
         CALL  CHGOBJ
         DEC   ROOM
         ENABLE
         JMP   DMSG016
VCLOSE   ENDP

;        CLOSE DOOR

CLOS01   PROC
         MOV   AL,ROOM
         CMP   AL,1
         JE    CLOS01_A
         CMP   AL,3
         JE    CLOS01_A
         CMP   AL,22
         LBEQ  DMSG018
         CMP   AL,43
         JE    CLOS01_C
         JMP   NOSEE
CLOS01_A:
         MOV   AL,112             ;OPEN DOOR
         CALL  CKOBJ
         LBEQ  DMSG021
         MOV   AH,111             ;CLOSED DOOR
CLOS01_B:
         CALL  CHGOBJ
         CALL  CKDRAW
         JMP   REPLY
CLOS01_C:
         DISABLE
         MOV   ROOM,22
         MOV   AL,98
         SUB   AH,AH
         CALL  CHGOBJ
         MOV   ROOM,43
         ENABLE
         JMP   SHORT CLOS01_B
CLOS01   ENDP

;        PAY VERB PROCESSOR

VPAY     PROC
         CMP   ROOM,4
         LBNE  BADINP
         MOV   AL,NOUNNO
         CMP   AL,20              ;RENT
         JE    VPAY_A
         CMP   AL,14              ;CASH
         JE    VPAY_A
         CMP   AL,121             ;LANDLORD
         LBNE  BADINP
VPAY_A:
         MOV   AL,121             ;LANDLORD
         CALL  CKOBJ
         LBEQ  DMSG023
;
;        PROTECTION BEGINS
;
         MOV   AL,PROTSW
         CMP   AL,VALIDSW
         LBNE  DMSG026
;
;        PROTECTION ENDS
;
         MOV   AL,14              ;$102.00
         CALL  HAVOBJ
         LBEQ  DMSG026
         MOV   AH,15              ;$2.00
         CALL  REPOBJ
         MOV   AL,121
         SUB   AH,AH
         CALL  CHGOBJ
         CALL  CKDRAW
         MOV   BX,OFFSET MSG024
         CALL  DISPLY
         MOV   AL,23              ;CLOTHES
         CALL  HAVOBJ
         LBNE  REPLY
         JMP   DMSG025
VPAY     ENDP

;        BUY VERB PROCESSOR

VBUY     PROC
         CMP   NOUNNO,19
         LBNE  BADINP
         CMP   ROOM,12
         LBNE  NOSEE
         MOV   AL,15              ;$2.00
         CALL  HAVOBJ
         LBEQ  VBUY_C
         MOV   BX,OFFSET MSG028
         CALL  DISPLY
         CALL  GETLIN
         CALL  SCNKEY
         MOV   AL,VERBNO
         CMP   AL,25
         JE    VBUY_A
         CMP   AL,26
         JE    VBUY_A
         CMP   AL,27
         JE    VBUY_A
         JMP   BADINP
VBUY_A:
         MOV   BEERSW,AL
         MOV   AL,19
         CALL  HAVOBJ
         JNE   VBUY_Z
         MOV   AL,32              ;EMPTY GLASS
         CALL  HAVOBJ
         JE    VBUY_X
VBUY_Z:
         SUB   AH,AH
         CALL  REPOBJ
VBUY_X:
         MOV   AL,32
         SUB   AH,AH
         CALL  CHGOBJ
         MOV   AL,19
         CALL  CHGOBJ
         CALL  PUTNRM
         CALL  CKDRAW
         MOV   AL,15
         SUB   AH,AH
         CALL  REPOBJ
         DISABLE
         MOV   ROOM,2
         CALL  PUTNRM
         MOV   ROOM,12
         ENABLE
         MOV   AL,BEERSW
         CMP   AL,26
         JNE   VBUY_B
         MOV   AL,13+INV
         DISABLE
         DEC   ROOM
         CALL  RMVIS
         INC   ROOM
         ENABLE
VBUY_B:
         JMP   DMSG039
VBUY_C:
         MOV   BEERSW,0
         JMP   DMSG026
VBUY     ENDP

;        PULL VERB PROCESSOR

VPULL    PROC
         CMP   NOUNNO,24          ;KNIFE
         LBEQ  OPEN05
         JMP   BADINP
VPULL    ENDP

;        SHOW VERB PROCESSOR

VSHOW    PROC
         JMP   SHORT VPULL
VSHOW    ENDP

;        SAY VERB PROCESSOR

VSAY     PROC
         CMP   NOUNNO,31          ;SEAN
         LBNE  BADINP
VSEAN:
         MOV   AL,97+INV          ;BRIDGE
         CALL  MAKVIS
         JE    VSAY_A
         MOV   BX,OFFSET MSG052
         CALL  DELAY
         MOV   BX,OFFSET MSG053
         CALL  DISPLY
         MOV   AL,97
         CALL  CKDRAW
VSAY_A:
         JMP   REPLY
VSAY     ENDP

;        LIGHT VERB PROCESSOR

VLIGHT   PROC
         MOV   AL,NOUNNO
         CMP   AL,11              ;FLASHLIGHT
         JE    VLIGHT_E
         CMP   AL,29              ;ON
         JE    VLIGHT_A
         CMP   AL,30              ;OFF
         LBNE  BADINP
VLIGHT_A:
         MOV   AL,28              ;LIT FLASHLIGHT
         CALL  HAVOBJ
         JNE   VLIGHT_B
         MOV   AL,11              ;FLASHLIGHT
         CALL  HAVOBJ
         LBEQ  NOHAVE
VLIGHT_B:
         CMP   NOUNNO,29
         JE    VLIGHT_C
         MOV   AL,28
         MOV   AH,11
         CALL  REPOBJ
         CALL  INDARK
VLIGHT_D:
         JMP   REPLY
VLIGHT_C:
         MOV   AL,11
         MOV   AH,28
         CALL  REPOBJ
         MOV   AL,ROOM
         CMP   AL,39
         JB    VLIGHT_D
         CMP   AL,44
         JA    VLIGHT_D
         CALL  DRAWSC
         JMP   SHORT VLIGHT_D
VLIGHT_E:
         MOV   NOUNNO,29          ;LIGHT ON
         JMP   SHORT VLIGHT
VLIGHT   ENDP

;        UNLIGHT VERB PROCESSOR

VUNLIT   PROC
         CMP   NOUNNO,11          ;FLASHLIGHT
         LBNE  BADINP
         MOV   NOUNNO,30          ;LIGHT OFF
         JMP   SHORT VLIGHT
VUNLIT   ENDP

;        READ VERB PROCESSOR

VREAD    PROC
         MOV   AL,NOUNNO
         CMP   AL,116             ;SIGN
         JE    VREAD_A
         CMP   AL,122             ;BILLBOARD
         LBNE  BADINP
VREAD_A:
         JMP   LOOK11
VREAD    ENDP

;        TALK VERB PROCESSOR

VTALK    PROC
         JMP   BADINP
VTALK    ENDP

;        TALK LANDLORD

TALK01   PROC
         MOV   AL,121             ;LANDLORD
         CALL  CKOBJ
         LBEQ  DMSG023
         JMP   DMSG022
TALK01   ENDP

;        TALK BARKEEP

TALK02   PROC
         CMP   ROOM,12
         LBNE  DMSG023
         JMP   DMSG038
TALK02   ENDP

;        DRINK VERB PROCESSOR

VDRINK   PROC
         MOV   AL,19              ;BEER
         CALL  HAVOBJ
         LBEQ  NOHAVE
         MOV   AH,32              ;EMPTY GLASS
         CALL  REPOBJ
         JMP   DMSG054
VDRINK   ENDP

;        BLOW HORN

BLOW01   PROC
         MOV   AL,26              ;HORN
         CALL  HAVOBJ
         LBEQ  NOHAVE
         MOV   BX,OFFSET MSG058
         CALL  DISPLY
         TEST  ROPESW,0FFH
         LBNE  REPLY
         INC   ROPESW
         MOV   AL,34              ;ROPE
         CALL  PUTNRM
         JMP   DMSG011
BLOW01   ENDP

;        RUB VERB PROCESSOR

VRUB     PROC
         MOV   AL,NOUNNO
         CMP   AL,17              ;TOKEN
         LBNE  BADINP
         CALL  HAVOBJ
         LBEQ  NOHAVE
         CMP   ROOM,17
         LBNE  REPLY
         MOV   BX,OFFSET MSG041
         CALL  DELAY
         MOV   AL,16
         JMP   EXITRM
VRUB     ENDP

;        ROLL VERB PROCESSOR

VROLL    PROC
         MOV   AL,NOUNNO
         CMP   AL,104             ;GIRL
         JE    VROLL_A
         CMP   AL,27              ;OVER
         LBNE  BADINP
         MOV   AL,104
VROLL_A:
         CALL  CKOBJ
         LBEQ  DMSG040
         MOV   BX,OFFSET MSG045
         CALL  DELAY
         MOV   AL,12+INV
         CALL  MAKVIS
         LBEQ  REPLY
         CALL  CKDRAW
         JMP   DMSG011
VROLL    ENDP

;        ENTER ROOM 1

ENTR01   PROC
         PUSH  AX
         MOV   AL,23              ;WEARING CLOTHES
         MOV   AH,9               ;JEANS & SHIRT
         CALL  REPOBJ
         POP   AX
         RET
ENTR01   ENDP

;        ENTER ROOM 6

ENTR06   PROC
         PUSH  AX
         MOV   AL,23              ;CLOTHES
         CALL  HAVOBJ
         LBEQ  DMSG031
         POP   AX
         RET
ENTR06   ENDP

;        ENTER ROOM 8

ENTR08   PROC
         PUSH  AX
         MOV   AL,110             ;MUGGERS
         CALL  CKOBJ
         LBNE  DMSG032
         POP   AX
         RET
ENTR08   ENDP

;        ENTER ROOM 17

ENTR17   PROC
         PUSH  AX
         PUSH  BX
         MOV   AL,17              ;TOKEN
         CALL  HAVOBJ
         JE    ENTR17_A
         MOV   BX,OFFSET MSG042
         CALL  DISPLY
ENTR17_A:
         POP   BX
         POP   AX
         RET
ENTR17   ENDP

;        ENTER ROOM 44

ENTR44   PROC
         PUSH  AX
         PUSH  BX
         MOV   AL,RANDOM
         AND   AL,07FH
         CMP   AL,30
         JA    ENTR44_A
         MOV   BX,OFFSET MSG050
         CALL  DISPLY
ENTR44_A:
         POP   BX
         POP   AX
         RET
ENTR44   ENDP

;        ENTER ROOM 46

ENTR46   PROC
         PUSH  AX
         MOV   AL,8               ;SHOES
         CALL  HAVOBJ
         JNE   ENTR46_B
         MOV   BX,OFFSET MSG057
ENTR46_A:
         CALL  DISPLY
         JMP   ENDGAM
ENTR46_B:
         MOV   AL,33              ;POLE
         CALL  HAVOBJ
         JNE   ENTR46_C
         MOV   BX,OFFSET MSG062
         JMP   SHORT ENTR46_A
ENTR46_C:
;
;        PROTECTION BEGINS
;
         MOV   AL,PROTSW
         CMP   AL,VALIDSW
         JE    ENTR46_D
         MOV   BX,OFFSET MSG062
         JMP   SHORT ENTR46_A
;
;        PROTECTION ENDS
;
ENTR46_D:
         POP   AX
         RET
ENTR46   ENDP

;        IN ROOM 12

INRM12   PROC
         PUSH  AX
         MOV   AL,8               ;SHOES
         CALL  HAVOBJ
         JNE   INRM12_C
         MOV   BX,OFFSET MSG044
         CALL  DELAY
         MOV   AL,19              ;BEER
         CALL  HAVOBJ
         JNE   INRM12_A
         MOV   AL,32              ;EMPTY GLASS
         CALL  HAVOBJ
         JE    INRM12_B
INRM12_A:
         SUB   AH,AH
         CALL  REPOBJ
         CALL  PUTNRM
INRM12_B:
         MOV   NOUNNO,0
         MOV   ROOM,11
         JMP   VLOOK
INRM12_C:
         POP   AX
         RET
INRM12   ENDP

;        IN CAVE ROOM

INCAVE   PROC
         PUSH  AX
         CALL  INDARK
         POP   AX
         RET
INCAVE   ENDP

;        EXIT ROOM 1

EXIT01   PROC
         PUSH  AX
         MOV   AL,9               ;SHIRT & JEANS
         MOV   AH,23              ;WEARING CLOTHES
         CALL  REPOBJ
;
;        PROTECTION BEGINS
;
         MOV   AL,VALIDSW
         CMP   AL,PROTSW
         JE    EXIT01_A
         MOV   AL,8               ;SHOES
         SUB   AH,AH
         CALL  XCHGOB
         MOV   AL,12+INV          ;SHAMROCK
         CALL  XCHGOB
;
;        PROTECTION ENDS
;
EXIT01_A:
         POP   AX
         RET
EXIT01   ENDP

;        EXIT ROOM 4

EXIT04   PROC
         PUSH  AX
         CMP   NOUNNO,2           ;GOING SOUTH?
         JE    EXIT04_A
         MOV   AL,121             ;LANDLORD
         CALL  CKOBJ
         JE    EXIT04_A
         JMP   DMSG022
EXIT04_A:
         POP   AX
         RET
EXIT04   ENDP

;        EXIT ROOM 6

EXIT06   PROC
         PUSH  AX
         CMP   NOUNNO,2           ;GOING SOUTH
         JE    EXIT06_A
         MOV   AL,23              ;CLOTHES
         CALL  HAVOBJ
         JNE   EXIT06_A
         MOV   NOUNNO,0
         MOV   ROOM,15
         JMP   VLOOK
EXIT06_A:
         POP   AX
         RET
EXIT06   ENDP

;        EXIT ROOM 8

EXIT08   PROC
         PUSH  AX
         MOV   AL,110             ;MUGGERS
         CALL  CKOBJ
         JE    EXIT08_B
         CMP   NOUNNO,3           ;GOING EAST?
         JNE   EXIT08_B
         MOV   AL,15
         CALL  HAVOBJ
         JE    EXIT08_A
         SUB   AH,AH
         CALL  REPOBJ
         DISABLE
         MOV   ROOM,2
         CALL  PUTNRM
         MOV   ROOM,8
         ENABLE
EXIT08_A:
         JMP   DMSG033
EXIT08_B:
         POP   AX
         RET
EXIT08   ENDP

;        EXIT ROOM 12

EXIT12   PROC
         PUSH  AX
         MOV   AL,19              ;BEER
         CALL  HAVOBJ
         JNE   EXIT12_A
         MOV   AL,32              ;EMPTY GLASS
         CALL  HAVOBJ
         JE    EXIT12_B
EXIT12_A:
         SUB   AH,AH
         CALL  REPOBJ
         CALL  PUTNRM
EXIT12_B:
         POP   AX
         RET
EXIT12   ENDP

;        EXIT ROOMS 27 & 28

EXIT27   PROC
         PUSH  AX
         CMP   NOUNNO,6           ;DOWN?
         JNE   EXIT27_A
EXT27A:
         MOV   AL,34              ;ROPE
         CALL  HAVOBJ
         JNE   EXIT27_A
         MOV   BX,OFFSET MSG061
         CALL  DISPLY
         JMP   REPLY
EXIT27_A:
         POP   AX
         RET
EXIT27   ENDP

;        EXIT ROOM 30

EXIT30   PROC
         PUSH  AX
         CMP   NOUNNO,5           ;UP?
         JE    EXT27A
         CMP   NOUNNO,6           ;DOWN?
         JE    EXT27A
         POP   AX
         RET
EXIT30   ENDP

;        EXIT ROOM 38

EXIT38   PROC
         PUSH  AX
         PUSH  BX
         CMP   AH,39
         JNE   EXIT38_A
         MOV   AL,33              ;POLE
         CALL  HAVOBJ
         JNE   EXIT38_B
EXIT38_A:
         POP   BX
         POP   AX
         JMP   SHORT EXIT30
EXIT38_B:
         MOV   BX,OFFSET MSG060
         CALL  DISPLY
         JMP   REPLY
EXIT38   ENDP

;        EXIT ROOM IN CAVE

EXITCV   PROC
         PUSH  AX
         MOV   AL,28              ;LIT FLASH LIGHT
         CALL  LOCOBJ
         JNE   EXITCV_A
         MOV   AL,RANDOM
         AND   AL,07FH
         CMP   AL,60
         JA    EXITCV_A
         MOV   BX,OFFSET MSG048
         CALL  DISPLY
         JMP   ENDGAM
EXITCV_A:
         POP   AX
         RET
EXITCV   ENDP


INDARK   PROC
         CMP   ROOM,39
         JB    INDARK_A
         CMP   ROOM,44
         JA    INDARK_A
         MOV   AL,28              ;LIT FLASHLIGHT
         CALL  LOCOBJ
         JNE   INDARK_A
         MOV   SI,OFFSET SCRBLK
         CALL  SHOSCR
         CALL  CLSTXT
         MOV   BX,OFFSET MSG049
         CALL  DISPLY
         SUB   AL,AL
         JMP   SHORT INDARK_B
INDARK_A:
         MOV   AL,1
INDARK_B:
         TEST  AL,0FFH
         RET
INDARK   ENDP

ECHMOV   PROC
         RET
ECHMOV   ENDP

CHKPA    PROC
         CMP   AL,23              ;WEARING CLOTHES
         JNE   CHKPA_A
         SUB   AL,AL
CHKPA_A:
         TEST  AL,0FFH
         RET
CHKPA    ENDP

CHKGA    PROC
         TEST  AL,0FFH
         RET
CHKGA    ENDP

;
;        END FILE: ADVCODE2.ASM   --   SEA SEARCH
;
